//
//  IMINetXML.h
//  IMINet
//
//  Created by Travis on 09-11-29.
//  Copyright imi.im 2009. All rights reserved.
//	More Information: http://imi.im

#import <Foundation/Foundation.h>
#import <IMIBase/IMIBase.h>

@class IMINetXML;

@protocol IMINetXMLDelegate
@optional
-(void)XMLDidStart:(IMINetXML*)xml;
-(void)XMLDidFinish:(IMINetXML*)xml;

@end


@interface IMINetXMLNode : NSObject
{
	NSMutableArray *children;
	IMINetXMLNode *parent;
	
	NSMutableDictionary *attributes;
	
	NSString *name;
	NSMutableString *value;
	NSString *xpath;
	
}

@property(nonatomic,retain)	NSMutableArray *children;
@property(nonatomic,assign)	IMINetXMLNode *parent;

@property(nonatomic,retain)	NSMutableDictionary *attributes;
@property(nonatomic,retain)	NSString *name;
@property(nonatomic,retain)	NSMutableString *value;
@property(nonatomic,readonly)	NSString *xpath;

+(id)node;

-(void)addChild:(IMINetXMLNode*)child;
-(void)removeChild:(IMINetXMLNode*)child;

@end


@interface IMINetXML : IMINetXMLNode {
	NSXMLParser *parser;
	NSObject<IMINetXMLDelegate> *delegate;
	
	IMINetXMLNode *currentChild;
}


@property(nonatomic,retain) IMINetXMLNode *currentChild;

- (id) initWithData:(NSData*)xmlData withDelegate:(NSObject<IMINetXMLDelegate> *)dlg;

@end
